home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
United Public Domain Gold 2
/
United Public Domain Gold 2.iso
/
utilities
/
pu245.dms
/
pu245.adf
/
Amiga
/
Appendices
/
FunctionsAndLibraries
/
GraphicsLibrary.doc
< prev
next >
Wrap
Text File
|
1992-05-03
|
38KB
|
1,370 lines
2 GRAPHICS LIBRARY
2.1 OPEN THE GRAPHICS LIBRARY
The Graphics Library must have been opened before you may use
the functions listed in this file.
/* Declare a pointer to the Graphics Library: */
struct GfxBase *GfxBase;
/* Open the Graphics Library: */
GfxBase = (struct GfxBase *)
OpenLibrary( "graphics.library", 0 );
if( !GfxBase )
exit(); /* Could NOT open the Graphics Library! */
/* ... */
/* Close the Graphics Library: */
CloseLibrary( GfxBase );
2.2 FUNCTIONS
AddBob()
This function will add a BOB to the current list of graphical
objects. Remember to remove all BOBs from the list before
your program terminates. Either use the RemBob() or RemIBob()
functions to remove a BOB.
Synopsis: AddBob( bob, rast_port );
bob: (struct Bob *) Pointer to an already initialized
Bob structure. The Bob structure must also have
been connected to an initialized VSprite
structure.
rast_port: (struct RastPort *) Pointer to the display's
RastPort. The display must have been opened before
you may add BOBs to it. NOTE! Before you may call
this function you must have declared and
initialized a GelsInfo structure, and linked it
to this RastPort.
AddVSprite()
This function will add a VSprite to the VSprite list.
Synopsis: AddVSprite( vsprite, rp );
vsprite: (struct VSprite *) Pointer to an initialized
VSprite structure.
rp: (struct RastPort *) Pointer to the RastPort.
AllocRaster()
This function reserves display memory (one BitPlane).
Synopsis: pointer = AllocRaster( width, height );
pointer (PLANEPTR) Pointer to the allocated memory or NULL
if enough memory could not be reserved.
width: (long) The width of the BitMap.
height: (long) The height of the BitMap.
AreaDraw()
This function will add a new vertex to the vector list.
Synopsis: AreaDraw( rast_port, x, y );
rast_port: (struct RastPort *) Pointer to the RastPort that
should be affected.
x: (long) New X position.
y: (long) New Y position.
AreaEllipse()
This function will draw a filled ellipse. Remember to
allocate a temporary buffer of at least the same size as the
largest object that will be drawn.
Synopsis: AreaEllipse( rast_port, x, y, width, height );
rast_port: (struct RastPort *) Pointer to the RastPort in
which the filled ellipse should be drawn.
x: (long) X position of the filled ellipse.
y: (long) Y position of the filled ellipse.
width: (long) The width of the left or right part of
the ellipse.
height: (long) The height of the top or bottom part of
the ellipse.
AreaEnd()
This function will close, draw and fill the polygon.
Synopsis: AreaEnd( rast_port );
rast_port: (struct RastPort *) Pointer to the RastPort that
should be affected.
AreaMove()
This function will start a new polygon.
Synopsis: AreaMove( rast_port, x, y );
rast_port: (struct RastPort *) Pointer to the RastPort that
should be affected.
x: (long) Start X position.
y: (long) Start Y position.
AskSoftStyle()
This function tells us how a specified font may be changed,
and which styles may be automatically created. Use the
function SetSoftStyle() to later change style. The reason why
you have to check if you are allowed to alter the style is
that some fonts may look very bad when altered.
Note that you should always first try to load the font with
the desired style. It is only when the desired style does not
exist you should try to modify it with the SetSoftStyle()
function.
Synopsis: a_style = AskSoftStyle( rast_port )
a_style: (UWORD) The function returns a bit field where the
allowed style bits for the checked font are set. This
value should be used as a parameter when you later
call the SetSoftStyle() function.
rast_port: (struct RastPort *) Pointer to the rastport to
which the font you want to check is connected.
AvailFonts()
This function will scan through the font directory of the
system disk, and return a complete list of available fonts.
Synopsis: missing = AvailFonts( buffer, size, type );
missing: (long) If the buffer was not big enough to store
the complete list of fonts in the extra number of
bytes needed is returned. If 0 is returned the
buffer was big enough for a complete list of fonts.
buffer: (char *) Pointer to some memory were the list of
fonts can be stored.
size: (long) The size of the buffer (in bytes).
type: (long) If you want to look for available fonts
which are already in the memory set the flag
"AFF_MEMORY". If you want to search the disk for
available fonts, set the flag "AFF_DISK". To
search both the memory and the disk set both flags
with the binary OR operator between:
"AFF_DISK | AFF_MEMORY".
BltBitMap()
This function copies parts of BitMaps directly without
worrying about overlapping layers.
Synopsis: BltBitMap( sb, sx, sy, db, dx, dy, w, h, fl, m, t );
sb: (struct BitMap *) Pointer to the "source" BitMap.
sx: (long) X offset, source.
sy: (long) Y offset, source.
db: (struct BitMap *) Pointer to the "destination"
BitMap.
dx: (long) X offset, destination.
dy: (long) Y offset, destination.
w: (long) The width of the memory area that should be
copied.
h: (long) The height of the memory area that should be
copied.
fl: (long) The four leftmost bits tells the blitter
what kind of logically operations should be done.
m: (long) You can here define a BitMap mask, and tell
the blitter which BitPlanes should be used, and
which should not. The first bit represents the
first BitPlane, the second bit the second BitPlane
and so on. If the bit is on (1) the corresponding
BitPlane will be used, else (0) the BitPlane will
not be used. To turn off BitPlane zero and two, set
the mask value to 0xFA (11111010). To use all
BitPlanes set the mask value to 0xFF (11111111).
t: (char *) If the copy overlaps and this pointer
points to some chip-memory, the memory will be used
to store the temporary area in. However, normally
you do not need to bother about this value.
BltClear()
This function clears large rectangular memory areas. This
function work together with the blitter and is therefore very
fast.
Synopsis: BltClear( pointer, bytes, flags );
pointer (char *) Pointer to the memory.
bytes: (long) The lower 16 bits tells the blitter how many
bytes per row, and the upper 16 bits how many rows.
This value is automatically calculated for you with
help of the macro RASSIZE(). Just give RASSIZE()
the correct width and height and it will return the
correct value. [RASSIZE() is defined in file
"gfx.h".]
flags: (long) Set bit 0 to force the function to wait
until the Blitter has finished with your request.
ChangeSprite()
This function changes the sprite data (image) of a sprite.
Synopsis: ChangeSprite( view_port, my_sprite, new_data );
view_port: (struct ViewPort *) Pointer to the ViewPort which
this sprite is connected to, or 0 if the sprite is
connected to the current View.
my_sprite: (struct SimpleSprite *) Pointer to your
SimpleSprite structure.
new_data: (short *) Pointer to the new sprite data.
ClearEOL()
This function will clear the area to the right of the current
position. The height of the area which is cleared is set to
fit the current font height.
Synopsis: ClewarEOL( rp );
rp: (struct RastPort *) Pointer to a rastport. The area
from the current position to the right edge of the
rastport is cleared. The height of the area
depends on the current font size. Normally is the
cleared area set to colour 0, but if you are using
draw mode "JAM2" will the area be filled with the
BgPen colour.
ClearScreen()
This function will clear the area to the right of the current
position and the area below.
Synopsis: ClewarScreen( rp );
rp: (struct RastPort *) Pointer to a rastport. The area
from the current position to the right edge of the
rastport is cleared. The area below is also cleared.
Normally is the cleared area set to colour 0, but
if you are using draw mode "JAM2" will the area be
filled with the BgPen colour.
ClipBlit()
This function copies parts of BitMaps with help of Rastports
and will therefore care about overlapping layers, and should
be used if you have windows on your display.
Synopsis: ClipBlit( srp, sx, sy, drp, dx, dy, w, h, flag );
srp: (struct RastPort *) Pointer to the "source"
RastPort.
sx: (long) X offset, source.
sy: (long) Y offset, source.
drp: (struct RastPort *) Pointer to the "destination"
RastPort.
dx: (long) X offset, destination.
dy: (long) Y offset, destination.
w: (long) The width of the memory area that should be
copied.
h: (long) The height of the memory area that should be
copied.
flag: (long) This value tells the blitter what kind of
logically operations should be done. See below for
more information.
CloseFont()
All fonts you have opened with the OpenFont() function must
be "closed" before your program terminates! You close ROM
fonts by calling the CloseFont() function.
Synopsis: CloseFont( font );
font: (struct TextFont *) Pointer to a previously opened
TextFont structure. Note that you should NOT try to
close a font which you have not opened!
DoCollision()
This function tells the system to check all objects, and
call the collision routines if any object has hit one or
more borders or another object.
Note! Whenever you want to check for collision you should
first sort the list by calling the SortGList() function.
The system may otherwise miss some objects.
Synopsis: DoCollision( rast_port );
rast_port: (struct RastPort *) Pointer to the RastPort to
which the objects you want to check are connected
to.
Draw()
This function draws single lines from the current position
to the new specified position.
Synopsis: Draw( rast_port, x, y );
rast_port: (struct RastPort *) Pointer to the RastPort that
should be affected.
x: (long) The new X position.
y: (long) The new Y position.
DrawEllipse()
This function will draw an ellipse.
Synopsis: DrawEllipse( rast_port, x, y, width, height );
rast_port: (struct RastPort *) Pointer to the RastPort in
which the ellipse should be drawn.
x: (long) X position of the ellipse.
y: (long) Y position of the ellipse.
width: (long) The width of the left or right part of
the ellipse.
height: (long) The height of the top or bottom part of
the ellipse.
DrawGList()
This function will draw the VSprites into the specified
Rastport.
Synopsis: DrawGList( rp, vp );
rp: (struct RastPort *) Pointer to the RastPort.
vp: (struct ViewPort *) Pointer to the ViewPort.
Flood()
This function will flood fill complicated objects.
Synopsis: Flood( rast_port, mode, x, y );
rast_port: (struct RastPort *) Pointer to the RastPort that
should be affected.
mode: (long) Which mode should be used. If you want to
use the Colour mode set the mode variable to 1, to
get the Outline mode set the mode variable to 0.
x: (long) X position where the flood fill should
start.
y: (long) Y position where the flood fill should
start.
FreeColorMap()
This function deallocates the memory that was allocated by
the GetColorMap() function. Remember to deallocate all memory
that you allocate. For every GetColorMap() function there
should be one FreeColorMap() function.
FreeColorMap( colormap );
colormap: (struct ColorMap *) Pointer to a ColorMap structure
that GetColorMap() returned and you now want to
deallocate.
FreeCprList()
This function will return all memory that was automatically
allocated by the MrgCop() function.
Synopsis: FreeCprList( cprlist );
cprlist: (struct cprlist *) Pointer to the View's cprlist
(LOFCprList) structure. If the View was interlaced
you must also call the FreeCprList function with a
pointer to the SHFCprList.
FreeRaster()
This function will deallocate display memory (BitPlane).
Remember to deallocate all BitPlanes!
Synopsis: FreeRaster( bitplane, width, height );
bitplane: (PLANEPTR) Pointer to a Bitplane.
width: (long) The Bitplane's width.
height: (long) The Bitplane's height.
FreeSprite()
This function returns an already reserved sprite.
Synopsis: FreeSprite( sprite_got );
sprite_got: (long) The sprite you want to free (0-7).
FreeVPortCopLists()
This function will return all memory that was automatically
allocated by the MakeVPort() function. Remember to call
FreeVPortCopLists() for every ViewPort you have created!
Synopsis: FreeVPortCopLists( viewport );
view: (struct ViewPort *) Pointer to the ViewPort.
GetColorMap()
This function allocates and initializes a ColorMap structure.
Synopsis: colormap = GetColorMap( colours );
colormap: (struct ColorMap *) GetColorMap returns a pointer
to the ColorMap structure it has allocated and
initialized, or NULL if not enough memory.
colours: (long) A value specifying how many colours you
want that the ColorMap structure should store.
(1, 2, 4, 8, 16, 32)
GetSprite()
This function reserves a sprite. You must always reserve a
sprite before you may use it.
Synopsis: spr_got = GetSprite( my_sprite, spr_wanted );
spr_got: (long) GetSprite() returns the number of the
sprite you got (0-7). If it could not get the
desired sprite, it returns -1. Remember to check
if you got the sprite you wanted! (the
SimpleSprite structure's num field will also
be initialized automatically.)
my_sprite: (struct SimpleSprite *) Pointer to your
SimpleSprite structure.
spr_wanted: (long) The number of the hardware sprite you want
to use (0-7). If it does not matter which sprite
you get you can write -1. (The System will then
give you any free hardware sprite.)
InitBitMap()
This function initializes a BitMap structure.
Synopsis: InitBitMap( bitmap, depth, width, height );
bitmap: (struct BitMap *) Pointer to the BitMap.
depth: (long) How many BitPlanes used.
width: (long) The width of the raster.
height: (long) The height of the raster.
InitGels()
This function "gives" an already prepared GelsInfo structure
to the system.
Synopsis: InitGels( head, tail, ginfo );
head: (struct VSprite *) Pointer to the first "dummy"
VSprite structure.
tail: (struct VSprite *) Pointer to the second "dummy"
VSprite structure.
ginfo: (struct GelsInfo *) Pointer to an initialized GelsInfo
structure.
InitMasks()
This function will automatically create a collision and a
border line mask for a VSprite or BOB.
Synopsis: InitMasks( vsprite );
vsprite: (struct VSprite *) Pointer to the object's VSprite
structure. InitMasks() will work both with simple
VSprites as well as with BOBs. It will look at the
objects image and do a binary OR operation on it,
and stores the result in the memory area which
"CollMask" is pointing to.
If you have created a collision mask for a BOB can
you also use it as the BOB's shadow image.
The function will also create a "border line" which
is used for boundary collisions.
InitRastPort()
This function initializes a RastPort.
Synopsis: InitRastPort( rast_port );
rast_port: (RastPort *) Pointer to the RastPort that should
be Initialized.
InitView()
This function will initialize a View structure.
Synopsis: InitView( view );
view: (struct View *) Pointer to the View that should be
initialized.
InitVPort()
This function will initialize a ViewPort structure.
Synopsis: InitVPort( view_port );
view_port: (struct ViewPort *) Pointer to the ViewPort that
should be initialized.
MakeVPort()
This function prepares the Amiga's hardware (especially the
Copper) to display a ViewPort. NOTE! You have to prepare
EVERY ViewPort you are going to use!
Synopsis: MakeVPort( view, viewport );
view: (struct View *) Pointer to the ViewPort's View.
viewport: (struct ViewPort *) Pointer to the ViewPort.
Move()
This function moves the cursor.
Synopsis: Move( rast_port, x, y );
rast_port: (struct RastPort *) Pointer to the RastPort that
should be affected.
x: (long) The new X position.
y: (long) The new Y position.
MoveSprite()
Use this function to move a sprite.
Synopsis: MoveSprite( view_port, my_sprite, x, y );
view_port: (struct ViewPort *) Pointer to the ViewPort which
this sprite is connected to, or 0 if the sprite
is connected to the current View.
my_sprite: (struct SimpleSprite *) Pointer to your
SimpleSprite structure.
x, y: (long) The new position on the display. (Sprites
use low-resolution pixels.)
MrgCop()
This function puts together all displayinstructions and
prepares the view to be showed.
Synopsis: MrgCop( view );
view: (struct View *) Pointer to the View.
LoadView()
This function will start showing a View. Remember that when
you close your View you must switch back to the old view.
(See examples for more details.)
Synopsis: LoadView( view );
view: (struct View *) Pointer to the View.
OpenFont()
This function is used to get access to a ROM font. You
initialize a TextAttr structure with your requirements,
and send a pointer to it as the only parameter. If
OpenFont() finds the font it returns a pointer to a
TextFont structure and tells the system that you are using
the font. Remember to close all fonts you have opened with
the CloseFont() function.
Synopsis: font = OpenFont( attr );
font: (struct TextFont *) Pointer to a TextFont structure
or NULL if OpenFont() could not find the font.
attr: (struct TextAttr *) Pointer to an initialized
TextAttr structure. OpenFont() will try to open the
font which closes matches your requirements.
PolyDraw()
This function will draw multiple lines.
Synopsis: PolyDraw( rast_port, number, coordinates );
rast_port: (struct RastPort *) Pointer to the RastPort that
should be affected.
number: (long) The number of coordinates (x,y) defined
in the array.
coordinates: (short *) Pointer to an array of coordinates.
ReadPixel()
This function reads the colour value of a pixel.
Synopsis: colour = ReadPixel( rast_port, x, y );
colour: (long) ReadPixel returns the colour value of the
specified pixel (colour 0 - 255 ) or -1 if the
coordinates were outside the Raster.
rast_port: (struct RastPort *) Pointer to the RastPort which
contain the pixel you want to examine.
x: (long) X position of the pixel.
y: (long) Y position of the pixel.
RectFill()
This function will draw filled rectangles.
Synopsis: RectFill( rast_port, minx, miny, maxx, maxy );
rast_port: (struct RastPort *) Pointer to the RastPort that
should be affected.
minx: (long) Left position of the rectangle.
miny: (long) Top - " -
maxx: (long) Right - " -
maxy: (long) Bottom - " -
RemBob()
This function will remove a specified BOB for the list of
graphical elements. The BOB will first disappear after
you have resorted and drawn the list again (using the
SortGList() and DrawGList() functions). If you want to
remove the BOB and the image immediately you should use
the RemIBob() function.
Synopsis: RemBob( bob );
bob: (struct Bob *) Pointer to the BOB that should be
removed. Do not try to remove a BOB which you have
not previously added to the list.
RemIBob()
This function will remove a specified BOB from the current
list of graphical elements. The image will also immediately
be removed.
Synopsis: RemIBob( bob, rast_port, view_port );
bob: (stuct Bob *) Pointer to the BOB that should
immediately be removed. The image will directly
be removed (and the background restored if the
SAVEBACK flag was set).
rast_port: (struct RastPort *) Pointer to the RastPort to
which the BOB is connected.
view_port: (struct ViewPort *) Pointer to the display's
ViewPort.
RemVSprite()
This function will remove a previously added VSprite.
Synopsis: RemVSprite( vsprite );
vsprite: (struct VSprite *) Pointer to the VSprite you want
to remove.
ScrollRaster()
This function will scroll a rectangular area of a raster.
Synopsis: ScrollRaster( rp, dx, dy, minx, miny, maxx, maxy );
rp: (struct RastPort *) Pointer to the RastPort that
should be affected.
dx: (long) Delta X movement. (A positive number moves
the area to the right, a negative number to the
left.)
dy: (long) Delta Y movement. (A positive number moves
the area down, a negative number up.)
minx: (long) Left edge of the rectangle.
miny: (long) Top edge of the rectangle.
maxx: (long) Right edge of the rectangle.
maxy: (long) Bottom edge of the rectangle.
SetAPen()
This function will change the FgPen's colour.
Synopsis: SetAPen( rast_port, new_colour );
rast_port: (struct RastPort *) Pointer to the RastPort that
should be affected.
new_colour: (long) A new colour value.
SetBPen()
This function will change the BgPen's colour.
Synopsis: SetBPen( rast_port, new_colour );
rast_port: (struct RastPort *) Pointer to the RastPort that
should be affected.
new_colour: (long) A new colour value.
SetCollision()
This function will set a collision routine function.
Synopsis: SetCollision( number, function, gels_info );
number: (long) Which routine (0 - 15) you set.
function: (__fgptr = (void *()) Pointer to the function
which should be executed when the specified
collision routine occurs.
gels_info: (struct GelsInfo *) Pointer to the GelsInfo
structure. Note that you must have given the
collHandler field of the GelsInfo structure a
pointer to a collTable structure before you may
use this function!
SetDrMd()
This function will change the drawing mode.
Synopsis: SetDrMd( rast_port, new_mode );
rast_port: (struct RastPort *) Pointer to the RastPort that
should be affected.
new_mode: (long) The new drawing mode. Set one of the
following: JAM1, JAM2, COMPLEMENT, INVERSVID|JAM1
or INVERSVID|JAM2.
JAM1 The FgPen will be used, the
background unchanged. (One colour
jammed into a Raster.)
JAM2 The FgPen will be used as foreground
pen while the background (when you
are writing text for example) will
be filled with the BgPen's colour.
(Two colours are jammed into a
Raster.)
COMPLEMENT Each pixel affected will be drawn
with the binary complement colour.
Where you write 1's the
corresponding bit in the Raster
will be reversed.
INVERSVID|JAM1 This mode is only use together with
text. Only the background of the
text will be drawn with the FgPen.
INVERSVID|JAM2 This mode is only use together with
text. The background of the text
will be drawn with the FgPen, and
the characters itself with the
BgPen.
SetFont()
This function will change a RastPort's font. The font must
of course have been successfully opened before you may start
to use it.
Synopsis: error = SetFont( rp, font );
error: (long) If OK 0 is returned, else an error number is
returned which means something went wrong.
rp: (struct RastPort *) Pointer to the RastPort that
should be affected.
font: (struct TextFont *) Pointer to a TextFont structure
which has previously been "opened".
SetRast()
This function sets a whole Raster to a specific colour.
Synopsis: SetRast( rast_port, colour );
rast_port: (struct RastPort *) Pointer to the RastPort that
should be affected.
colour: (long) The colour reg. you want to fill the whole
raster with.
SetRGB4()
This function allows you to change your screen's colours.
Each colour may be picked out of a 4096 colour palette. (16
levels of red, 16 levels of green and 16 levels of blue;
16*16*16 = 4096.)
IMPORTANT! Before you may use this function you must have
opened the Graphics Library. (All other functions are in the
Intuition Library.) (See chapter 0 AMIGA for more
information.)
Synopsis: SetRGB4( viewport, register, red, green, blue );
viewport: (struct ViewPort *) Pointer to a ViewPort which
colour registers we are going to change. We can
find the screen's ViewPort in the Screen
structure. (If my_screen is a pointer to a Screen
structure, this will get us a pointer to that
screen's ViewPort: &my_screen->ViewPort)
register: (long) The colour register you want to change.
The screen's Depth decides how many colour
registers the screen have:
Depth Colour Registers
-----------------------
1 0 - 1
2 0 - 3
3 0 - 7
4 0 - 15
5 0 - 31
6 0 - 63
red: Amount of red. (0 - 15)
green: Amount of green. (0 - 15 )
blue: Amount of blue. (0 - 15 )
Eg: SetRGB4( &my_screen->ViewPort, 2, 15, 15, 0 ); will
change colour register 2 to be light yellow. (Red and green
together will be yellow.)
SetSoftStyle()
This function will alter the style of a specified font. You
should first find out which styles you may alter by calling
the AskSoftStyle() function before you call this function.
Synopsis: new_style = SetSoftStyle( rp, style, a_style );
new_style: (UWORD) The function will only create the styles
it is allowed to do (see a_styles), and it may
therefore happen that the function will not
generate all of the styles you wanted. This
returned value tells us which style bits it used.
rp: (struct RastPort *) Pointer to the rastport to
which the font you want to change is connected.
style: (UWORD) The desired style.
a_style: (UWORD) The styles you may use. This value was
returned by AskSoftStyle(). If you want to be able
to use all styles and do not care if some styles
would look strange set this field to 0xFFFF (all
styles allowed). This can result in some very ugly
styles, and is therefore not recommended.
SortGList()
This function will reorganize the VSprite list so that the
further down on the display the sprites are positioned the
later they will appear in the list.
Synopsis: SortGList( rp );
rp: (struct RastPort *) Pointer to the RastPort.
Text()
This function prints text into a Raster.
Synopsis: Text( rast_port, string, nr_of_chr );
rast_port: (struct RastPort *) Pointer to the RastPort that
should be affected.
string: (char *) Pointer to a text string that will be
printed.
nr_of_chr: (long) The number of characters that should be
printed.
TextLength()
This function will return the number of pixels wide the text
string would be if printed with the rastport's current font.
Synopsis: width = TextLength( rp, string, nr_chars );
width: (long) Number of pixels wide the text string would
be if printed with the rastport's current font.
rp: (struct RastPort *) Pointer to the rastport.
string: (char *) Pointer to the string containing the text
you want to measure.
nr_chars: (long) Number of characters in the string that
should be counted.
VBeamPos()
This function will return the current vertical position of
the video beam.
Synopsis: vert_line = VBeamPos();
vert_line: (long) The current vertical position of the video
beam.
WaitTOF()
This function waits for the video beam to reach the top of
the display. Can be used if you want to slow down the speed
a bit, and make the animation smoother.
Synopsis: WaitTOF();
WaitBOVP()
This function waits for the video beam to reach the bottom of
the specified view port. If you are redrawing something at
the same time as the picture is drawn by the video beam the
modified area will apear to "flicker". If you instead use
this function to wait for the beam to pass the view port
before you redraws it there is less risk that the display
will start to "flicker".
If you have to do a lot of drawing you may not manage to
complete the redrawing before the video beam is once again
moved over your drawings. In that case you have to use a
"double buffered display". See chapter "Graphical Tricks"
for more information.
Synopsis: WaitBOVP( view_port );
view_port: (struct ViewPort *) This function will wait until
the video beam has passed the view port which this
field points to.
WritePixel()
This function will draw a single pixel.
Synopsis: WritePixel( rast_port, x, y );
rast_port: (struct RastPort *) Pointer to the RastPort that
should be affected.
x: (long) X position of the pixel.
y: (long) Y position of the pixel.
2.3 MACROS
To use these macros you have to include the header file
"graphics/gfxmacros.h".
AreaCircle()
This macro will draw a filled circle. Remember to allocate a
temporary buffer of at least the same size as the largest
object that will be drawn.
Synopsis: AreaCircle( rast_port, x, y, radius );
rast_port: (struct RastPort *) Pointer to the RastPort in
which the circle should be drawn.
x: (long) X position of the circle.
y: (long) Y position of the circle.
radius: (long) The circle's radius.
BNDROFF()
This macro (declared in file "gfxmacro.h") will turn off the
outline mode.
Synopsis: BNDROFF( rast_port );
rast_port: Pointer to the RastPort which outlinefunction
should be turned off.
CEND()
This macro will put an "end" mark at the end of the user
copper list. After you have added all desired copper commands
you have to call this macro to tell the Copper that this is
the end of the list.
Synopsis: CEND( copper );
copper: (struct UCopList *) Pointer to the user copper list
structure that should be "ended".
CINIT()
This macro will initialize a user copper list. This should
always be done before you may add any copper commands.
Synopsis: CINIT( copper, nr_instr );
copper: (struct UCopList *) Pointer to the user copper list
structure you have previously allocated. Note that
the structure must be in chip memory.
nr_instr: (long) This field can be used to specify how many
copper instructions should be used. However, when
we later set the copper instructions they will
automatically allocate the memory which is needed,
so this field is actually almost unnecessary. Set
this field to 1.
CMOVE()
This macro will add a move instruction in a user coper list.
Synopsis: CMOVE( copper, register, value );
copper: (struct UCopList *) Pointer to the user copper list
structure you have previously allocated and
initialized with the CINIT() macro.
register: (long) Pointer to the hardware (system) register
you want to change. If you want to change the
colours you can find the colour registers in the
array "color" in the Custom structure. To alter the
first colour register you would write
"custom.color[0]", to alter the second colour
register you would write "custom.color[1]", and so
on... There exist in total 32 colour registers,
although the current screen does not necessarily
use all of them.
value: (long) This is the value that should be inserted.
When you are using the colour registers this value
should be specified in "RGB" form. The four left-
most bit represents the blue colour, the next four
bits the green colour, and finally the last four
bits the red value.
CWAIT()
This macro will add a wait instruction in a user coper list.
Synopsis: CWAIT( copper, y, x );
copper: (struct UCopList *) Pointer to the user copper list
structure you have previously allocated and
initialized with the CINIT() macro.
y: (long) The Copper will wait for the video beam to
reach this vertical position.
x: (long) When the video beam has reach the above
specified vertical position the Copper will
continue to wait until the beam reaches this
horizontal position. Normally this field is set to
0, but does not have to be that.
DrawCircle()
This macro will draw a circle.
Synopsis: DrawCircle( rast_port, x, y, radius );
rast_port: (struct RastPort *) Pointer to the RastPort in
which the circle should be drawn.
x: (long) X position of the circle.
y: (long) Y position of the circle.
radius: (long) The circle's radius.
SetAfPt()
This macro will set the area pattern:
Synopsis: SetAfPt( rast_port, area_pattern, pow2 );
rast_port: (struct RastPort *) Pointer to the RastPort
that should be affected.
area_pattern: (UWORD) Pointer to an array of UWORDS that
generate the pattern. Each bit in the array
represents one dot.
pow2: (BYTE) The pattern must be two to the power of
pow2 lines tall. If the pattern is one line tall
pow2 should be set to 0, if the pattern is two
lines tall pow2 should be set to 1, if the
pattern is four lines tall pow2 should be set to
2, and so on. (If you use multicoloured patterns
the pow2 should be negative. A sixteen lines
tall multicoloured pattern should therefore have
the pow2 value set to -4 [2^4 = 16].)
SetDrPt()
This macro will set the line pattern.
Synopsis: SetDrPt( rast_port, line_pattern );
rast_port: (struct RastPort *) Pointer to the RastPort
that should be affected.
line_pattern: (UWORD) The pattern. Each bit represents one
dot. To generate solid lines you set the
pattern value to 0xFFFF [hex] (1111111111111111
[bin]).
SetOPen()
This macro will change the AOlPen's colour. Note! This is not
a function. It is actually a macro that is defined in the
header file "gfxmacros.h". If you want to use this function
you have to remember to include this file.
Synopsis: SetOPen( rast_port, new_colour );
rast_port: (struct RastPort *) Pointer to the RastPort that
should be affected.
new_colour: (long) A new colour value.